package top.lucky.common;

public enum EnumAddressKeyword {
    NMGZZQ("内蒙古自治区", 6, EnumAddressLevel.PROVINCE_LEVEL, false),
    GXZZZZQ("广西壮族自治区", 7, EnumAddressLevel.PROVINCE_LEVEL, false),
    XZZZQ("西藏自治区", 5, EnumAddressLevel.PROVINCE_LEVEL, false),
    NXHZZZQ("宁夏回族自治区", 7, EnumAddressLevel.PROVINCE_LEVEL, false),
    XJWWEZZQ("新疆维吾尔自治区", 8, EnumAddressLevel.PROVINCE_LEVEL, false),
    BJS("北京市", 3, EnumAddressLevel.PROVINCE_LEVEL, false),
    TJS("天津市", 3, EnumAddressLevel.PROVINCE_LEVEL, false),
    SHS("上海市", 3, EnumAddressLevel.PROVINCE_LEVEL, false),
    CQS("重庆市", 3, EnumAddressLevel.PROVINCE_LEVEL, false),
    NMG("内蒙古", 3, EnumAddressLevel.PROVINCE_LEVEL, false),
    GX("广西", 2, EnumAddressLevel.PROVINCE_LEVEL, false),
    XZ("西藏", 2, EnumAddressLevel.PROVINCE_LEVEL, false),
    NX("宁夏", 2, EnumAddressLevel.PROVINCE_LEVEL, false),
    XJ("新疆", 2, EnumAddressLevel.PROVINCE_LEVEL, false),
    SZXXJXZQH("省直辖县级行政区划", 9, EnumAddressLevel.CITY_LEVEL, false),
    ZZQZXXJXZQH("自治区直辖县级行政区划", 11, EnumAddressLevel.CITY_LEVEL, false),
    SHENG("省", 1, EnumAddressLevel.PROVINCE_LEVEL, true),
    ZZZ("自治州", 3, EnumAddressLevel.CITY_LEVEL, true),
    DIQU("地区", 2, EnumAddressLevel.CITY_LEVEL, true),
    MENG("盟", 1, EnumAddressLevel.CITY_LEVEL, true),
    DJSHI("市", 1, EnumAddressLevel.CITY_LEVEL, true),
    ZZX("自治县", 3, EnumAddressLevel.AREA_LEVEL, true),
    QU("区", 1, EnumAddressLevel.AREA_LEVEL, true),
    XIAN("县", 1, EnumAddressLevel.AREA_LEVEL, true),
    QI("旗", 1, EnumAddressLevel.AREA_LEVEL, true),
    XJSHI("市", 1, EnumAddressLevel.AREA_LEVEL, true);

    /** 地址关键字 */
    private String keyword;
    /** 关键字长度 */
    private Integer length;
    /** 关键字地址级别 */
    private EnumAddressLevel enumAddressLevel;
    /** 是否有前缀 */
    private Boolean hasPrefix;

    EnumAddressKeyword(String keyword, Integer length, EnumAddressLevel enumAddressLevel, Boolean hasPrefix) {
        this.keyword = keyword;
        this.length = length;
        this.enumAddressLevel = enumAddressLevel;
        this.hasPrefix = hasPrefix;
    }

    /**
     * 根据地址关键字查找
     *
     * @param keyword
     * @return com.wdph.user.center.boot.EnumAddressKeyword
     * @author yeshuai
     * @date 2021/11/23 16:39
     */
    public static EnumAddressKeyword findByKeyword(String keyword) {
        for (EnumAddressKeyword e : EnumAddressKeyword.values()) {
            if (e.getKeyword().equals(keyword)) {
                return e;
            }
        }
        return null;
    }

    public String getKeyword() {
        return keyword;
    }

    public Integer getLength() {
        return length;
    }

    public EnumAddressLevel getEnumAddressLevel() {
        return enumAddressLevel;
    }

    public Boolean getHasPrefix() {
        return hasPrefix;
    }



}
